#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2021/7/3
# @Author  : LiJun
# @Email   : lijun@tianyancha.com
# @Version : 1.0.0

from common.appium_base_method import BasePage
import allure

class AddDetailsPage(BasePage):

    @allure.step("添加成员详情页")
    def save_details(self, name, phone, condition=True):
        from appium_0701.po_page.add_member_method_page import AddMemberMethod
        with allure.step("添加姓名"):
            self.find_send(*self.by_maps(self.element["AddDetailsName"]), message=name)

        with allure.step("添加手机号"):
            self.find_send(* self.by_maps(self.element["AddDetailsPhone"]), message=phone)
        with allure.step("点击保存按钮"):
            self.find_click(*self.by_maps(self.element["AddDetailsSave"]))

        if condition:
            return AddMemberMethod(driver_base=self.driver, element=self.element)

